﻿<Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:WinKee"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Converters="using:WinKee.Converters"
    x:Class="WinKee.Pages.SettingsPage"
    mc:Ignorable="d"
    DataContext="{Binding RelativeSource={RelativeSource Mode=Self}}"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

    <Page.Resources>
        <Converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
    </Page.Resources>

    <Grid x:Name="LayoutRoot">

        <Grid.ChildrenTransitions>
            <TransitionCollection>
                <EntranceThemeTransition/>
            </TransitionCollection>
        </Grid.ChildrenTransitions>

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!-- Title Panel -->
        <StackPanel Grid.Row="0" Margin="19,0,0,0">
            <TextBlock Text="WinKee" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,12,0,0"/>
            <TextBlock Text="settings" Margin="0,-6.5,0,26.5" Style="{ThemeResource HeaderTextBlockStyle}" CharacterSpacing="{ThemeResource PivotHeaderItemCharacterSpacing}"/>
        </StackPanel>

        <StackPanel Orientation="Vertical" Grid.Row="1" x:Name="ContentRoot" Margin="19,9.5,19,0">
            <ToggleSwitch x:Name="RequiresPinToggleSwitch" Toggled="RequiresPinToggled" Header="Ask for password on app resume" HorizontalAlignment="Stretch" Margin="0" VerticalAlignment="Top"/>
            <TextBlock Margin="0,0,0,5" HorizontalAlignment="Stretch" Visibility="{Binding RequiresPinCode, Converter={StaticResource BoolToVisibilityConverter}}" FontSize="17" FontStyle="Italic" Foreground="{StaticResource PhoneAccentBrush}" TextWrapping="WrapWholeWords" Text="You will have 3 attempts to enter your password when resuming the application."/>
            <ToggleSwitch x:Name="DisplayUsernameInListToggleSwitch" Toggled="DisplayUsernameInListToggleSwitch_OnToggled" Header="Usernames in entry list" HorizontalAlignment="Stretch" Margin="0" VerticalAlignment="Top"/>
            <ToggleSwitch x:Name="UseColorsInListToggleSwitch" Toggled="UseColorsInListToggleSwitch_OnToggled" Header="Custom colors in entry list" HorizontalAlignment="Stretch" Margin="0" VerticalAlignment="Top"/>
            <ToggleSwitch x:Name="UseMRUToggleSwitch" Toggled="UseMRUToggleSwitch_OnToggled" Header="Remember most recently used DBs" HorizontalAlignment="Stretch" Margin="0" VerticalAlignment="Top"/>
            <Button Content="Clear list" Command="{Binding ClearMRUCommand}"/>
        </StackPanel>
    </Grid>
</Page>
